﻿extern alias ShapesLibrary;
using Microsoft.Windows.Design.Metadata;
using System;
using System.ComponentModel;
using ControlsLibrary = ShapesLibrary::OhZeeCreative.UI.Controls;

[assembly: ProvideMetadata(typeof(OhZeeCreative.Windows8.UI.Shapes.Design.Metadata))]
namespace OhZeeCreative.Windows8.UI.Shapes.Design
{
    public class Metadata : IProvideAttributeTable
    {
		readonly string Appearance = CategoryAttribute.Appearance.Category;

		private static AttributeTable attributeTable;

		public AttributeTable AttributeTable
		{
			get
			{
				if (attributeTable == null)
				{
					AttributeTableBuilder builder = new AttributeTableBuilder();

					builder.AddTable(this.Checkers);
					builder.AddTable(this.Sunburst);
					builder.AddTable(this.Starburst);

					attributeTable = builder.CreateTable();
				}

				return attributeTable;
			}
		}

        public AttributeTable Checkers
        {
            get
            {
				AttributeTableBuilder builder = new AttributeTableBuilder();

				Type type = typeof(ControlsLibrary.Checkers);

				builder.AddCustomAttributes(type, "CellWidth", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "CellWidth", new DescriptionAttribute("Gets or sets the width of each cell in pixels."));

				builder.AddCustomAttributes(type, "CellHeight", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "CellHeight", new DescriptionAttribute("Gets or sets the height of each cell in pixels."));

				attributeTable = builder.CreateTable();
				return attributeTable;
            }
        }

		public AttributeTable Sunburst
		{
			get
			{
				AttributeTableBuilder builder = new AttributeTableBuilder();

				Type type = typeof(ControlsLibrary.Sunburst);
				builder.AddCustomAttributes(type, "OriginX", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OriginX", new DescriptionAttribute("Gets or sets the the origin on the X-axis. 0 is left-most edge, 1 is right-most edge."));

				builder.AddCustomAttributes(type, "OriginY", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OriginY", new DescriptionAttribute("Gets or sets the the origin on the Y-axis. 0 is top-most edge, 1 is bottom-most edge."));

				builder.AddCustomAttributes(type, "ApexDeltaX", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ApexDeltaX", new DescriptionAttribute("Gets or sets the amount the apex will be offset from the origin in pixels on the X-axis."));

				builder.AddCustomAttributes(type, "ApexDeltaY", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ApexDeltaY", new DescriptionAttribute("Gets or sets the amount the apex will be offset from the origin in pixels on the Y-axis."));

				builder.AddCustomAttributes(type, "ApexShiftAngle", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ApexShiftAngle", new DescriptionAttribute("Gets or sets the angle in degrees between the origin and the apex according to Cartesian coordinates."));

				builder.AddCustomAttributes(type, "ApexShiftAmount", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ApexShiftAmount", new DescriptionAttribute("Gets or sets the amount the apex will be shifted from the origin by the specified amount. A shift of 1 moves the apex to the circumference of the circle."));

				builder.AddCustomAttributes(type, "RaysProperty", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "RaysProperty", new DescriptionAttribute("Gets or sets the number of rays. Must be a minimum of 1."));

				builder.AddCustomAttributes(type, "Rotation", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "Rotation", new DescriptionAttribute("Gets or sets the rotation of the rays. At 0 rotation, the first ray is aligned with the X-axis."));

				builder.AddCustomAttributes(type, "FillContainer", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "FillContainer", new DescriptionAttribute("Determines whether the circle should fill its bounds."));

				builder.AddCustomAttributes(type, "ApexAdjustmentMode", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ApexAdjustmentMode", new DescriptionAttribute("Determines how to adjust the focal point of the rays. Depending on the mode, drawing is affected either by DeltaX and DeltaY properties or ShiftAngle and ShiftAmount."));

				// builder.AddCustomAttributes(type, "Edge", new CategoryAttribute(Appearance)); // Will go into Brush
                builder.AddCustomAttributes(type, "Edge", new DescriptionAttribute("Gets or sets the brush for the edges of each ray."));

				builder.AddCustomAttributes(type, "EdgeThickness", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "EdgeThickness", new DescriptionAttribute("Gets or sets the thickness of the edges."));

				attributeTable = builder.CreateTable();
				return attributeTable;
			}
		}

		public AttributeTable Starburst
		{
			get
			{
				AttributeTableBuilder builder = new AttributeTableBuilder();

				Type type = typeof(ControlsLibrary.Starburst);
				builder.AddCustomAttributes(type, "OriginX", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OriginX", new DescriptionAttribute("Gets or sets the origin on the X-axis. 0 is left-most edge, 1 is right-most edge."));

				builder.AddCustomAttributes(type, "OriginY", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "OriginY", new DescriptionAttribute("Gets or sets the origin on the Y-axis. 0 is top-most edge, 1 is bottom-most edge."));

				builder.AddCustomAttributes(type, "ApexDeltaX", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ApexDeltaX", new DescriptionAttribute("Gets or sets the amount the apex will be offset from the origin in pixels on the X-axis."));

				builder.AddCustomAttributes(type, "ApexDeltaY", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ApexDeltaY", new DescriptionAttribute("Gets or sets the amount the apex will be offset from the origin in pixels on the Y-axis."));

				builder.AddCustomAttributes(type, "ApexShiftAngle", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ApexShiftAngle", new DescriptionAttribute("Gets or sets the angle in degrees between the origin and the apex according to Cartesian coordinates."));

				builder.AddCustomAttributes(type, "ApexShiftAmount", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ApexShiftAmount", new DescriptionAttribute("Gets or sets the amount the apex will be shifted from the origin by the specified amount. A shift of 1 moves the apex to the circumference of the circle."));

				builder.AddCustomAttributes(type, "RaysProperty", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "RaysProperty", new DescriptionAttribute("Gets or sets the number of rays. Must be a minimum of 1."));

				builder.AddCustomAttributes(type, "Rotation", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "Rotation", new DescriptionAttribute("Gets or sets the rotation of the rays. At 0 rotation, the first ray is aligned with the X-axis."));

				builder.AddCustomAttributes(type, "FillContainer", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "FillContainer", new DescriptionAttribute("Determines whether the circle should fill its bounds."));

				builder.AddCustomAttributes(type, "ApexAdjustmentMode", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "ApexAdjustmentMode", new DescriptionAttribute("Determines how to adjust the focal point of the rays. Depending on the mode, drawing is affected either by DeltaX and DeltaY properties or ShiftAngle and ShiftAmount."));

				// builder.AddCustomAttributes(type, "Edge", new CategoryAttribute(Appearance)); // Will go into Brush
                builder.AddCustomAttributes(type, "Edge", new DescriptionAttribute("Gets or sets the brush for the edges of each ray."));

				builder.AddCustomAttributes(type, "EdgeThickness", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "EdgeThickness", new DescriptionAttribute("Gets or sets the thickness of the edges."));

				builder.AddCustomAttributes(type, "AngleSweep", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "AngleSweep", new DescriptionAttribute("Gets or sets the sweep angle in degrees starting from 0 according to Cartesian coordinates."));

				builder.AddCustomAttributes(type, "InnerRadiusRatio", new CategoryAttribute(Appearance));
                builder.AddCustomAttributes(type, "InnerRadiusRatio", new DescriptionAttribute("Gets or sets the size of the inner radius relative to the outer radius which is determined by the size of the control. For a value of 0.5 inner radius is half the length of the outer radius."));
				
				attributeTable = builder.CreateTable();
				return attributeTable;
			}
		}
    }
}
